Skip to content

Snowflake: preserve reluctant MATCH_RECOGNIZE quantifiers - #2510

Open
osipovartem wants to merge 2 commits into
apache:mainfrom
Embucket:snowflake-match-recognize-reluctant
Open

osipovartem wants to merge 2 commits into
apache:mainfrom
Embucket:snowflake-match-recognize-reluctant

Conversation

@osipovartem

@osipovartem osipovartem commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Preserves the reluctant modifier on Snowflake/SQL MATCH_RECOGNIZE quantifiers. Previously, A*? was represented as (A*)?, changing a reluctant zero-or-more quantifier into a nested optional repetition.

The AST now represents this as Repetition(A, Reluctant(ZeroOrMore)). Existing Repetition(pattern, quantifier) construction remains unchanged, while the added Reluctant quantifier wrapper also covers +?, ??, and range forms such as {2,4}?. Stacked quantifiers that are not the single reluctant suffix are rejected.

Reference

Snowflake documents the reluctant suffix, its non-greedy semantics, and the supported quantifier forms in the MATCH_RECOGNIZE pattern syntax.

Tests

  • cargo +1.95.0 test --offline --all-features match_recognize (2 passed)
  • cargo +1.95.0 test --offline --all-features
  • cargo +1.95.0 fmt --all -- --check
  • Upstream stable, beta, nightly, no-std, lint, docs, codestyle, benchmark-lint, RAT, and license checks pass

@osipovartem
osipovartem force-pushed the snowflake-match-recognize-reluctant branch from 9274b3a to 80090eb Compare September 22, 2026 22:30
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.44444% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.98%. Comparing base (9ae00e7) to head (f144acc).

Files with missing lines Patch % Lines
src/parser/mod.rs 68.57% 3 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2510      +/-   ##
==========================================
+ Coverage   80.96%   80.98%   +0.01%     
==========================================
  Files          42       42              
  Lines       33359    33365       +6     
  Branches    33359    33365       +6     
==========================================
+ Hits        27009    27020      +11     
  Misses       2790     2790              
+ Partials     3560     3555       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants